﻿using System;
using System.Collections.Generic;
using System.Text;

namespace CSharpLearn
{
    class A
    {
        private static void A36()
        {
            String num = Console.ReadLine();
            int len = num.Length;
            int[] nums = new int[len];
            for (int i = 0; i < len; i++)
            {
                if (i == len - 1)
                {
                    int.TryParse(num.Substring(i), out (nums[i]));
                    break;
                }
                else
                {
                    int.TryParse(num.Substring(i, 1), out (nums[i]));
                }

            }
            Console.WriteLine("字符提取法");
            int sum = 0;
            foreach (int arr in nums)
            {
                sum += arr;
                Console.Write(arr + " ");
            }
            Console.WriteLine();
            Console.WriteLine("和为" + sum);
            Console.WriteLine("整数取余提取法");
            int num2 = int.Parse(num);
            int sum2 = 0;
            while (num2 > 0)
            {
                Console.Write(num2 % 10 + " ");
                sum2 += (num2 % 10);
                num2 /= 10;
            }
            Console.WriteLine();
            Console.WriteLine("和为" + sum2);
            Console.ReadLine();
        }
    }
}
